package Epic;

/**
 * A date is said to be a palindrome when it is expressed in MMDDYYYY format, 
 * it reads the same both ways. Given 2 years as input(ex: 2000, 2010),
 *  print out all the dates which are palindrome dates.
 * @author Ray
 *
 */
public class Palindrom_Date {

	public static void printDate(int start, int end){
		int[] month = {31,28,31,30,31,30,31,31,30,31,30,31};
		for(int i=start;i<=end;++i){
			String yyyy = Integer.toString(i);
			String mm = Integer.toString(i%10)+Integer.toString((i/10)%10);
			String dd = Integer.toString((i/100)%10)+Integer.toString((i/1000)%10);
			int mon = Integer.parseInt(mm);
			int day = Integer.parseInt(dd);
			if(mon>0 && mon<13 && day>0){
				int curDay = mon==2 ? (i%4==0 ? 29 : 28) : month[mon-1];
				if(day<=curDay){
					System.out.println(mm+dd+yyyy);
				}
			}
		}
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		printDate(9219, 9220);
	}

}
